package com.ruoyi.utils;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.mapper.SysDictTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/dict")
public class DictUtilsApp extends BaseController {

    @Autowired
    private SysDictDataMapper sysDictDataMapper;

    /**
     * 获取字典类型
     */
    @GetMapping("/getDictData/{type}")
    public TableDataInfo dictDataList(@PathVariable("type") String type){
        List<SysDictData> sysDictData = sysDictDataMapper.selectDictDataByType(type);
        return getDataTable(sysDictData);
    }


}
